# Convert wellcount data to the same format as input file.
# Input file: tx_emp.txt

BEGIN {
  FS = ","
  OFS = ","
  while ((getline line < "/home/huizi/HOLA/research/green-jobs/data/shale.csv") > 0) {
    split (line, x)
    county = x[1]
    year = x[2]
    month = x[3]
    wells_counts[county,year,month] = x[4]
    totalDays[county,year,month] = x[5]
    aveDays[county,year,month] = x[6]
  }
}

  
{
  if (FNR == 1)
    next

  if ($1 SUBSEP $2 SUBSEP $3 in wells_counts)
    print $0, wells_counts[$1,$2,$3], totalDays[$1,$2,$3], aveDays[$1,$2,$3]
  else
    print $0,0,"NA","NA"

}
